﻿using System.Text;
using System.Threading.Tasks;

using FluentNHibernate.Mapping;
using JiaBloggingSite.Core.Objects;

namespace JiaBloggingSite.Core.Mappings
{
    public class CommentMap : ClassMap<Comment>
    {
        public CommentMap()
        {
            Id(x => x.Id);

            Map(x => x.Content)
                .Length(5000)
                .Not.Nullable();

            Map(x => x.PostedOn)
                .Not.Nullable();

            References(x => x.Post)
                .Column("Post")
                .Not.Nullable();

            HasMany(x => x.ChildComments)
                .KeyColumn("ChildCommentID");
        }

    }
}
